counties.yml#
YAML File |
|
Loader Class |
|
Dumper Class |
|
Python Module |
|
Python Class |
YAML Structure#
The root object is a sequence with the no tag applied.
Top-Level Keys#
Because the root object of counties.yml is a sequence, there are no top-level keys. Each sequence item, however, is a mapping with the following keys:
|
Name of the state containing the county in all uppercase letters. |
|
Name of the county in all uppercase letters. |
|
Portion of the county’s FIPS code as a string indicating only the county, not the state. |
|
The number of the county as assigned by the state, if applicable. |
Anchors#
No anchors are used in counties.yml.
Python Implementation#
The CountyInfo Class#
...
Generating counties.yml#
The YAML file can be automatically generated by running the ng911ok.lib.counties module directly from the command line.
usage: counties.py [-h] (-s STATE_FIELD | -S STATE_DEFAULT) [-c COUNTY_FIELD] [-f FIPS_FIELD] [-n NUMBER_FIELD] input_feature_class output_yaml
positional arguments:
input_feature_class
output_yaml
options:
-h, --help show this help message and exit
-s STATE_FIELD, --state-field STATE_FIELD
-S STATE_DEFAULT, --state-default STATE_DEFAULT
-c COUNTY_FIELD, --county-field COUNTY_FIELD
-f FIPS_FIELD, --fips-field FIPS_FIELD
-n NUMBER_FIELD, --number-field NUMBER_FIELD
Note
Be sure to run as a module (with the -m flag) rather than as a script, e.g.,
python -m ng911ok.lib.counties "path\to\data.gdb\county_feature_class" "path\to\write\counties.yml" -c COUNTY_NAME -f COUNTY_FIPS_NO -n COUNTY_NO -S OKLAHOMA
Hint
If ModuleNotFoundError: No module named 'ng911ok' is encountered, change the working directory to the top-level Toolkit directory (the parent of the ng911ok directory).